package com.cloudbroker.bcs.csvc.sms.hsiuc.constants;

import java.util.Map;

import com.cloudbroker.bcs.csvc.base.api.util.HSBCCSUtil;
import com.cloudbroker.bcs.csvc.base.api.util.HSBCCSUtil.ErrorNoReader;

public class HSIUCErrorCodes {
    
    /**
     * 消息接收者为空（手机号为空）
     */
    public static final String RECEIVER_REQUIRED = "51010000";
    
    /**
     * 消息内容为空（短信内容为空）
     */
    public static final String CONTENT_REQUIRED = "51010001";
    
    /**
     * 机构编号或子系统编号为空
     */
    public static final String OWNCOMPANYID_AND_BUSINSYSNO_REQUIRED = "51010002";
    
    /**
     * 手机号为空
     */
    public static final String MOBILE_REQUIRED = "51010003";
    
    /**
     * 手机号不合法
     */
    public static final String MOBILE_ILLEGAL = "51010004";
    
    public static ErrorNoReader errorNoReader = new ErrorNoReader() {
        @Override
        public String getErrorNo(Map<String, Object> result) {
            Object errorNo = result.get(HSIUCFields.ERROR_CODE);
            return null == errorNo ? null : String.valueOf(errorNo);
        }
    };
    
    public static boolean isSuccess(Map<String, Object> result) {
        return HSBCCSUtil.isSuccess(result, errorNoReader, null);
    }
    
    public static boolean isErrorOf(Map<String, Object> result, String errorNo) {
        return HSBCCSUtil.isErrorOf(result, errorNoReader, null);
    }
    
}
